package site.yunnong.atvris.admin.controller;

import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * 标签表
 *
 * @author zhangjinghao
 * @email jhzhang9102@163.com
 * @date 2021-07-09 23:45:38
 */
@RestController
@RequestMapping("common/tags")
public class TagsController {

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("common:tags:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tagsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("common:tags:info")
    public R info(@PathVariable("id") Long id){
		TagsEntity tags = tagsService.getById(id);

        return R.ok().put("tags", tags);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("common:tags:save")
    public R save(@RequestBody TagsEntity tags){
		tagsService.save(tags);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("common:tags:update")
    public R update(@RequestBody TagsEntity tags){
		tagsService.updateById(tags);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("common:tags:delete")
    public R delete(@RequestBody Long[] ids){
		tagsService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
